Skip to content

Fix !timer date parsing: strict mode, flexible formats, time-before-date#31

Merged
Tsarpf merged 1 commit into
masterfrom
fix-timer-strict-parsing
Jun 26, 2026
Merged

Fix !timer date parsing: strict mode, flexible formats, time-before-date#31
Tsarpf merged 1 commit into
masterfrom
fix-timer-strict-parsing

Conversation

@jeto

@jeto jeto commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator
  • Accept time-before-date input (e.g. "14:45 12.3.2077") which previously silently set a wrong time due to lenient moment.js parsing
  • Parse only the first 1-2 tokens as date/time so an optional message after the date no longer breaks parsing in strict mode
  • Add single-digit day/month variants (D.M) alongside zero-padded (DD.MM)
  • Add reversed time-first formats (HH:mm DD.MM, HH:mm DD.MM.YYYY)
  • Add CI tests covering duration (5m, 2h), time-only, time-first date, date-first, and invalid input

Fixes #20

- Accept time-before-date input (e.g. "14:45 12.3.2077") which previously
  silently set a wrong time due to lenient moment.js parsing
- Parse only the first 1-2 tokens as date/time so an optional message
  after the date no longer breaks parsing in strict mode
- Add single-digit day/month variants (D.M) alongside zero-padded (DD.MM)
- Add reversed time-first formats (HH:mm DD.MM, HH:mm DD.MM.YYYY)
- Add CI tests covering duration (5m, 2h), time-only, time-first date,
  date-first, and invalid input

Fixes #20
@Tsarpf Tsarpf merged commit 611cdeb into master Jun 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timer sets wrong time with improper format

2 participants